MonitorMsg = function(){
	this.req = {};
	this.rsp = {};
	this.serviceCode = "";
	this.classPath = "";
	this.traceId = "";
	this.self = this;	
};

MonitorMsg.prototype = {
	
	/* POST后台提交数据 */	
	post:function(){
		var self = this.self;
		if(this.url == undefined){
			this.url = MUtil.getRootPath() + "/monitorService";
		}
		
		$.ajax({
            type: "POST",
            url: this.url,
            processData: false,
            async: false,
            data: "switch_json="+this.getReq(),
            dataType: 'text', 
            success: function(data){
            	//alert(data);
            	self.rsp = eval("("+data+")");
            }
        });
	},
	
	/* 获取返回码 */
	getRspResult:function(){
		return this.rsp.action.result;
	},
	
	/* 获取返回信息 */
	getRspMsg:function(){
		return this.rsp.action.message;
	},
	
	/* 获取返回数据类型 */
	getViewType:function(){
		return this.rsp.action.viewType;
	},
	
	/* 获取请求报文 */
	getReq:function(){
/*		alert(this.classPath);
		alert(this.monitorAppAuth);*/
		this.req = "";
		this.req += "{'action':{";		
		this.req += "'serviceCode':'"+this.serviceCode+"',";
		this.req += "'traceId':'"+this.traceId+"',";
		this.req += "'classPath':'"+this.classPath+"',";
		this.req += "'monitorAppAuth':'"+this.monitorAppAuth+"'";
		//添加额外参数
		if(this.param != undefined){
			for(var i in this.param){
				this.req += ",'"+i+"':"+"'"+this.param[i]+"'";
			}
		}
		
		this.req += "}}";
		
		//alert(this.req);
		return this.req;
	},
	
	/* 设置参数 */
	setParam:function(param){
		
		if(param.serviceCode != undefined){
			this.serviceCode = param.serviceCode;
		}
		
		if(param.traceId != undefined){
			this.traceId = param.traceId;
		}
		
		if(param.url != undefined){
			this.url = param.url;
		}
			
		if(param.param != undefined){
			this.param = param.param;
		}
		
		if(param.classPath != undefined){
			this.classPath = param.classPath;
		}
		
		if(param.monitorAppAuth != undefined){
			this.monitorAppAuth = param.monitorAppAuth;
		}else{
			this.monitorAppAuth = window.monitorAppAuth;
		}
		
	},
	
	/* 设置交易标示 */
	setServiceCode:function(serviceCode){
		this.serviceCode = serviceCode;
	},
	
	/* 设置交易流水 */
	setTraceID:function(traceId){
		this.traceId = traceId;
	},
		
	/* 设置地址信息 */
	setUrl:function(url){
		this.url = url;
	},
	


}